# -*- coding: utf-8 -*-

from zinx.ziface.irequest import IRequest
from zinx.ziface.irouter import IRouter
from abc import ABC, abstractmethod


class IMsgHandler(ABC):
    """
    消息管理抽象层
    """
    @abstractmethod
    def DoMsgHandler(self, request: IRequest):
        """
        调度/执行对应的Router消息处理方法
        :param request:
        :return:
        """
        pass

    @abstractmethod
    def AddRouter(self, msgID: int, router: IRouter):
        """
        为消息添加具体的处理逻辑
        :param msgID:
        :param router:
        :return:
        """
        pass

    @abstractmethod
    def StartWorkerPool(self):
        """
        启动worker工作池
        :return:
        """
        pass

    @abstractmethod
    def SendMsgToTaskQueue(self, request: IRequest):
        """
        将消息交给TaskQueue, 由worker进行处理
        :param request:
        :return:
        """
        pass